//
//  NSString+Util.h
//  MobileCRM
//
//  Created by winter on 16/2/22.
//  Copyright © 2016年 江苏金恒信息科技有限公司. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString(Util)

/// convert string to date
///
/// @params formatStr NSString format string
/// @return NSDate
- (NSDate *)convertToDateWithFormatStr:(NSString *)formatStr;

/// localiz string from specify table
///
/// @params tbl NSString *
/// @params comment NSString * comment
/// @return localized string NSString*
- (NSString *)stringWithLocalizedFromTable:(NSString *)tbl withComment:(NSString *)comment;

/// validate string with regex
///
/// @params regexStr NSString* regex string
/// @return validate result
- (BOOL)validateByRegEx:(NSString *)regexStr;

/// trimming whiteSpace and \n
///
/// @return result NSString*
- (NSString *)wsStringByTrimmingWhiteSpace;


/// convert string to color. UIColor+Util.h is needed
///
/// @return UIColor
- (UIColor *)wsStringConvertToUIColor;

/// convert string to color. UIColor+Util.h is needed
///
/// @return UIColor
- (UIColor *)wsStringConvertToUIColorWithAlpha:(CGFloat)alpha;

/// generate uuid string
///
/// @return NSString uuid String
+ (NSString *)wsGenUUID;

/// AEC-CBC Encrypt
///
/// @params NSString * keyStr key String
/// @return encrypt string
- (NSString *)aesCBCModelEncrypt:(NSString *)keyStr;

/// AEC-CBC decrypt
///
/// @params NSString * keyStr key String
/// @return decrypt string
- (NSData *)aesCBCModelDecryptForString:(NSString *)keyStr;

@end
